package com.gem.entity;

import com.gem.netty.entity.CurrentUser;
import com.gem.pipeline.ProcessModel;
import lombok.Data;

import java.util.*;

/**
 * Author: Xhy
 * CreateTime: 2022-09-21 17:57
 * 开始游戏所需要的信息
 */
@Data
public class Game implements ProcessModel {

    // 场上牌
    private Map<Integer, List<Card>> showCards;

    // 贵族
    private List<Nobility> nobilities;

    // 场上宝石
    private Map<Integer,Integer> gems;

    // 房间id
    private String roomId;

    // 当前出牌用户下标
    private Integer currentIndex;

    // 用于计当前用户回合阶段的序列号
    private Integer currentUserNo;

    // 当前回合开始时间戳
    private Long curBeginTime;

    // 当前出牌用户id
    private String userId;

    // 当前房间用户
    private List<CurrentUser> users;

    // 拥有15分的用户
    private PriorityQueue<CurrentUser> wins;


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Game game = (Game) o;
        return Objects.equals(showCards, game.showCards) &&
                Objects.equals(nobilities, game.nobilities) &&
                Objects.equals(gems, game.gems) &&
                Objects.equals(roomId, game.roomId) &&
                Objects.equals(currentIndex, game.currentIndex) &&
                Objects.equals(currentUserNo, game.currentUserNo) &&
                Objects.equals(userId, game.userId) &&
                Objects.equals(users, game.users) &&
                Objects.equals(wins, game.wins);
    }

    @Override
    public int hashCode() {
        return Objects.hash(showCards, nobilities, gems, roomId, currentIndex, currentUserNo, userId, users, wins);
    }
}
